<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/error.css">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="icon" href="../images/logo.ico" type="image/x-icon">
    <title>发生错误</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        function fun(){
            $.ajax({
                type:"POST",
                url:"${pageContext.request.contextPath}/login.do",
                data:{method:"getRootMsg"},
                dataType:"json",
                success:function (data) {
                    if (data!=null && data.haveSession=="no"){
                        $('.button_span').text('返回登录');
                        $('.button_href').attr('href','${pageContext.request.contextPath}/login.jsp');
                    }else {
                        $('.button_span').text('返回首页');
                        if (data.from==0 || data.from==1){
                            $('.button_href').attr('href','${pageContext.request.contextPath}/jsp/user.do?method=getLabList&local=introduce&from=user');
                        }else if (data.from==2){
                            $('.button_href').attr('href','${pageContext.request.contextPath}/jsp/user.do?method=getLabList&local=introduce&from=root');
                        }
                    }
                }
            })
        }
    </script>
</head>
<body onload="fun()">
<div class="mainImg"></div>
<h1 class="tips">发生甚么事了？网页飞走了！</h1>

<a href="" class="button_href">
    <button class="button" style="position: fixed; bottom: 10%; left: 50%;transform: translate(-50%,-50%)"><span class="button_span">返回首页 </span></button>
</a>

</body>
</html>